// 导入express
const express = require('express')
// 创建express服务器实例
const app = express()

// 通过 express.urlencoded() 这个中间件解析Url-encodeed格式的请求数据
app.use(express.urlencoded({ extended: false }))




// 解决跨域
const cors = require('cors')
app.use(cors())

// 静态资源托管
app.use(express.static('./upload'))

// 导出路由对象
const router = require('./router/router.js')
app.use('/api',router)









app.listen(3000,()=>{
    console.log('this serve is running at http://127.0.0.1:3000');
})